[Interface and Application Programming]-

Tasks for the week:

This week our assignment is to write an application that can interface with an input or output device.

Assignments:

I'm very new to applications and can do only minimal coding, hence I plan to start with something simple. After Listening to Neil's lecture I decided to try out MIT App Inventor, processing and Python in that order. I have very little time to do this as this week was already delayed due to my trouble shooting efforts in the Previous (Networking) week. I will try to finish as much as I can.

I plan on using I added button and LED on my echo hello board during electronics design week with the scope of using it as an input device that shows data by blinking LED. Hence, I decided to develop an interface for my hello echo board this week.

Task:01 Developing Interface

I chose to use processing this week to develop a GUI as it is similar to Arduino IDE. I found it easier to use, hence went ahead with it.

I started by looking at a few tutorials to develop an interface in processing. I simultaneously repeated the steps as in the tutorial to develop and understand the process of developing the interface. The screenshots below explain my process.

responsive

The above window opens on opening a new Processing file.

responsive

Next, since I was following a tutorial, I downloaded the library for Control P5 from Tools>Libraries.

responsive

Further, I initialized the GUI library.

responsive

I tried running the code, but since, I had only given a size and 0 value for background it showed me black box of 800x800 pixels.

I was trying to add a slider, hence I added command "Slider s= jControl.addSlider("back_color",0,255,10,100,10)". Here, 0, 255 are the black and white color that would appear while using the slider, 10 is the step, next 10 is the height and 100 is the length of the slider.:

responsive responsive

Task:02 Developing Interface for the Hello Echo Board

Since I used Attiny 44 for my echo hello board, I needed to add software serial to get data via serial communication. I needed to send data from my GUI to make LED on my board blink.

Hence, to begin with I modified the basic blink code of arduino and added Software serial to the code to begin serial communication between the RX-TX pins. The image below shows the MISO, MOSI, SCK connections from my board to the arduino via which I uploaded the code onto my board. The codes can be seen besides the image.

responsive
#include
int rxPin = 1;
int txPin = 0;
char val; // Data received from the serial port
int ledPin = 7; // Set the pin to digital I/O 4
SoftwareSerial my serial(rxPin, txPin);
void setup() {
pinMode(ledPin, OUTPUT); // Set pin as OUTPUT
my serial.begin(9600); // Start serial communication at 9600 bps
}
void loop() {
while (my serial.available()) { // If data is available to read,
val = my serial.read(); // read it and store it in val
}
if (val == 'H') { // If H was received
digitalWrite(ledPin, LOW); // turn the LED on
} else {
digitalWrite(ledPin, HIGH); // Otherwise turn it OFF
}
delay(100); // Wait 100 milliseconds for next reading
}
responsive

The above image shows the codes that I used to build the serial communication on my board.

Next, I used the basic simple write sketch of processing and modified it to develop my own customized GUI. The modified codes can be viewed below:

I modified the code such that, when I hover the cursor over the GUI, it sends a 'LED high' signal on my board leading to lighting up my LED.

responsive

The above images show the simple write code that I used to develop my interface in Processing.-

The below images shows the working of the code on my echo hello board.

responsive responsive

MIT app inventor-:

I used MIT app inventor to design a aap that will make LED Blink via bluetoth-

OUTPUT DEVICES -

In This week we have to make an app. There are many options for making App but I choose easiest one i.e MIT App Inventor.

MIT App Inventor:

responsive responsive

I am using bluetooth client because my app will use the blue connection to talk to my board. Thus I pick bluetooth client from the component section and also clock to give me the show me connection in real time. Both components are invisible components means they will not be shown on the active screen but they will be constantly working in the background.

After the app is ready I saved it and made a .apk file, download the file. Then I installed this app on my android and checked the connectivity.

This is my code.

responsive responsive

Temprecher

You can see the final video of MIT app inventor output-

Learning Outcomes-

In this assignment I learned about Interface and Application Programming which is really best for experiment the Application Programming and, app inventor Good experience in work.

To download my files click here